package presentation;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.GridLayout;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.Border;

/*
 * Creates the main menuscreen, with the different options: play, exit, number of players,..
 * 
 */
public class MenuPanel extends JPanel {
	//background
	public static ImageIcon background =
            new ImageIcon ("gamebackground1.jpg");
	/**
	 * Create the panel.
	 */
	public MenuPanel() {
		
		//Keep references to the next few borders,
        //for use in titles and compound borders.
        Border raisedbevel;
  
        //A border that puts 10 extra pixels at the sides and
        //bottom of each pane.
        Border paneEdge = BorderFactory.createEmptyBorder(0,100,100,100);
         
        raisedbevel = BorderFactory.createRaisedBevelBorder();
		
		JLabel menuLabel = new JLabel("Menu");
        menuLabel.setFont(new Font("Calibri", Font.PLAIN, 20));
        this.add(menuLabel);
        
        this.setBorder(paneEdge);
        
        this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
        //Different options
        addCompForBorder(raisedbevel, "Play", this);
        addCompForBorder(raisedbevel, "Instructions", this);
        addCompForBorder(raisedbevel, "Gestures", this);
        addCompForBorder(raisedbevel, "Number of players", this);
        addCompForBorder(raisedbevel, "Exit Game", this);
        
        this.setOpaque(true);
        this.setBackground(new Color(0,0,0,0));
	}
	
	//Set background and size
	@Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        g.drawImage(background.getImage(), 0, 0, null);
    }

    @Override
    public Dimension getPreferredSize() {
        return new Dimension(
        	background.getImage().getWidth(null),
        	background.getImage().getHeight(null));
    }
    
    void addCompForBorder(Border border, String description, Container container) {
		JPanel comp = new JPanel(new GridLayout(1, 1), false);
		JLabel label = new JLabel(description, JLabel.CENTER);
		label.setFont(new Font("Purisa", Font.PLAIN, 15));
		comp.add(label);
		comp.setBorder(border);

		container.add(Box.createRigidArea(new Dimension(0, 50)));
		container.add(comp);
}

}
